package com.kly.sc.api.application.controller.user.request;

import com.fqgj.common.api.ParamsObject;
import com.kly.sc.api.infras.enums.RestCodeEnum;
import com.kly.sc.api.infras.exception.ApplicationException;
import com.kly.user.enums.UserOpActionEnum;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 增加WLM用户请求类
 * @author linqu
 */
public class AddWlmRequest extends ParamsObject {

    /**
     * 用户内码
     */
    private String userCodeFriend;
    /**
     * 用户喜好：1-喜欢 2-不喜欢
     */
    private Integer likeType;
    /**
     * 用户操作：1 拉黑  2取消拉黑 3隐藏  4举报
     */
    private Integer opType;
    /**
     * 举报原因, opType=4必填
     */
    private String reason;
    /**
     * 用户操作：1-新用户 0-非新用户
     */
    private Integer newFlag;

    public Integer getNewFlag() {
        return newFlag;
    }

    public void setNewFlag(Integer newFlag) {
        this.newFlag = newFlag;
    }

    public String getUserCodeFriend() {
        return userCodeFriend;
    }

    public void setUserCodeFriend(String userCodeFriend) {
        this.userCodeFriend = userCodeFriend;
    }

    public Integer getLikeType() {
        return likeType;
    }

    public void setLikeType(Integer likeType) {
        this.likeType = likeType;
    }

    public Integer getOpType() {
        return opType;
    }

    public void setOpType(Integer opType) {
        this.opType = opType;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @Override
    public void validate() {
        if (Objects.equals(UserOpActionEnum.REPORT_USER.getType(), this.opType) && StringUtils.isBlank(this.reason)) {
            throw new ApplicationException("The reason should not be empty!");
        }

    }
}
